-
Notifications
You must be signed in to change notification settings - Fork 6
Update config files and always generate the client #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Replaced references to `~/.workato/credentials` with `~/.workato/profiles` throughout the codebase to align with the new configuration structure. - Updated `.gitignore` to exclude `.workatoenv` instead of `.workato/`. - Refactored `ProfileManager` and `ConfigManager` to manage profiles instead of credentials, enhancing clarity and functionality. - Adjusted unit tests to reflect changes in configuration file handling and ensure proper validation of profiles. - Improved error messages and user feedback in CLI commands related to profile management.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Workato CLI configuration system to replace the workato/ directory approach with a .workatoenv file-based system and renames the credentials configuration from "credentials" to "profiles".
- Replace
workato/directories with.workatoenvfiles for project configuration - Rename credentials file to profiles file (
~/.workato/credentials→~/.workato/profiles) - Update related functionality including gitignore patterns, file exclusion logic, and test cases
Reviewed Changes
Copilot reviewed 15 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_config.py | Updates test cases to use ProfilesConfig instead of CredentialsConfig and test profiles file operations |
| tests/unit/commands/test_push.py | Changes test to exclude .workatoenv file instead of workato/ directory |
| tests/unit/commands/test_pull.py | Updates gitignore and merge logic tests to handle .workatoenv instead of workato/ |
| tests/unit/commands/test_profiles.py | Updates profile command tests to reference profiles file instead of credentials |
| tests/unit/commands/projects/test_project_manager.py | New comprehensive test file for ProjectManager functionality |
| tests/unit/commands/projects/test_command.py | New comprehensive test file for project CLI commands |
| src/workato_platform/cli/utils/exception_handler.py | Minor text update removing "or expired" from auth error message |
| src/workato_platform/cli/utils/config.py | Major refactoring to use ProfilesConfig, .workatoenv files, and updated directory detection |
| src/workato_platform/cli/commands/push.py | Updates file exclusion logic for .workatoenv instead of workato/ directory |
| src/workato_platform/cli/commands/pull.py | Updates gitignore and merge logic for .workatoenv file handling |
| src/workato_platform/cli/commands/profiles.py | Updates profile command text to reference profiles file and keyring |
| src/workato_platform/_version.py | Version bump to 0.1.dev27 |
| src/.openapi-generator/FILES | Removes test files from generated client |
| pyproject.toml | Adds openapi-generator-cli dependency |
| .pre-commit-config.yaml | Adds client generation hook |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Updated the GitHub Actions workflow to include permissions for pull requests and added a coverage report generation step. - Modified the test execution command to run with coverage and added a step to comment on the pull request with the coverage report. - Refactored the API client configuration in
oalami
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Updated the `profiles.py` command to handle exceptions when loading workspace configurations, ensuring a fallback to default configuration data. - Enhanced unit tests for profile commands to cover various scenarios, including workspace context handling and error management. - Improved the `make_config_manager` function to streamline mock configuration for tests. - Added tests for the `ProfileManager` to validate token retrieval and storage with fallback mechanisms in case of keyring errors.
- Updated the CLI command structure to improve command naming consistency, changing `projects.project` to `projects.projects`. - Enhanced the `init` command to support non-interactive mode with additional parameters for profile, region, API token, and project details. - Implemented validation for required parameters in non-interactive mode to ensure proper setup. - Added JSON output support for listing profiles and projects, improving user experience and data accessibility. - Refactored project management commands to streamline project listing and switching functionality. - Updated unit tests to cover new features and ensure robust error handling in various scenarios.
- Updated type hints in various test files to enhance code clarity and maintainability. - Improved mock usage in tests, particularly for `ProfileManager` and `ConfigManager`, to streamline test setup and execution. - Refactored test functions to ensure consistency in parameter types and improve readability. - Enhanced error handling in tests to better simulate real-world scenarios and edge cases.
- Adjusted the `pyproject.toml` to exclude the generated client directory and version file from linting. - Modified the GitHub Actions workflow to remove specific exclusions from the `ruff` checks. - Improved formatting consistency in the `ignore_patterns.py` file. - Cleaned up the `__init__.py` file by removing unnecessary line breaks for better readability.
- Consolidated the CLI tool into a single `__init__.py` file, enhancing organization and readability. - Removed the obsolete `cli.py` and `push.py` files to streamline the codebase. - Updated import paths in test files to reflect the new CLI structure. - Improved command registration and initialization process for better maintainability.
- Deleted the `test_push.py` file, which contained unit tests for the push command. - This removal is part of a broader effort to streamline the codebase and eliminate obsolete test files.
…lity - Updated the non-interactive mode in `init.py` to require either a profile or both region and API token, improving user feedback on missing parameters. - Refactored the `list_projects` command in `command.py` to support listing projects from local, remote, or both sources, with enhanced output formatting for JSON and table modes. - Improved error handling in `ConfigManager` to ensure proper validation of region and API token requirements. - Updated unit tests to reflect changes in validation logic and project listing behavior, ensuring comprehensive coverage for new scenarios.
- Updated the initialization logic to require either a profile name or both region and API token for non-interactive setup, enhancing user feedback on parameter requirements.
This pull request introduces a major refactor to how user authentication profiles are managed, replacing the legacy
credentialsfile with a newprofilesfile and updating all related logic and messaging to match. It also updates project-specific configuration handling, switching from.workato/directories to a single.workatoenvfile, and ensures these are properly excluded from version control and packaging. Additionally, there are supporting updates for OpenAPI client generation and dependency management.Profiles and Credentials Refactor:
~/.workato/credentialsfile with~/.workato/profilesthroughout the codebase, including the data model (CredentialsConfig→ProfilesConfig), file paths, and all related logic inProfileManagerand CLI commands. All messages and documentation now referenceprofilesinstead ofcredentials. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Project Configuration and Exclusion Updates:
.workato/directory to a single.workatoenvfile, updating all helper functions, config management, and exclusion logic in commands such aspullandpushto reference.workatoenvinstead of.workato/. Ensured.workatoenvis added to.gitignoreand excluded from packaging and file deletion. [1] [2] [3] [4]Dependency and Tooling Improvements:
openapi-generator-clias a development dependency inpyproject.tomland introduced a local pre-commit hook for generating OpenAPI clients, streamlining API client updates for the project. [1] [2]Housekeeping and Versioning:
_version.pyto reflect the new release.